home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Codigo / Texto y fuentes / BetterFamiliesList / BetterFamiliesList.cs next >
Encoding:
Text File  |  2002-05-02  |  1.2 KB  |  40 lines

  1. //-------------------------------------------------
  2. // BetterFamiliesList.cs ⌐ 2001 by Charles Petzold
  3. //-------------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class BetterFamiliesList: PrintableForm
  9. {
  10.      public new static void Main()
  11.      {
  12.           Application.Run(new BetterFamiliesList());
  13.      }
  14.      public BetterFamiliesList()
  15.      {
  16.           Text = "Lista mejorada de familias de fuentes";
  17.      }
  18.      protected override void DoPage(Graphics grfx, Color clr, int cx, int cy)
  19.      {
  20.           Brush        brush = new SolidBrush(clr);
  21.           float        y     = 0;
  22.           FontFamily[] aff   = FontFamily.Families;
  23.  
  24.           foreach (FontFamily ff in aff)
  25.           {
  26.                if (ff.IsStyleAvailable(FontStyle.Regular))
  27.                {
  28.                     Font font = new Font(ff, 12);
  29.                     grfx.DrawString(ff.Name, font, brush, 0, y);
  30.                     y += font.GetHeight(grfx);
  31.                }
  32.                else
  33.                {
  34.                     grfx.DrawString("* " + ff.Name, Font, brush, 0, y);
  35.                     y += Font.GetHeight(grfx);
  36.                }
  37.           }
  38.      }
  39. }
  40.